import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

export  const store = new Vuex.Store({
    state:{
        login:false,
        name:'',
        pass:'',
    },
    getters:{
        login:(state)=>{
            return state.login;
        },
        name:state=>{
            return state.name;
        },
        pass:(state)=>{
            return state.pass;
        }
    },
    mutations:{
        updatedlogin:(state,payload)=>{
            state.login = payload;
        },
        setName:(state,payload)=>{
            state.name = payload;
        },
        setPass:(state,payload)=>{
            state.pass = payload;
        }
    },
    actions:{
        updatedlogin:({commit},payload)=>{
            commit('updatedlogin',payload)
        },
        setName:({commit},payload)=>{
            commit('setName',payload)
        },
        setPass:({commit},payload)=>{
            commit('setPass',payload)
        }
    }
})